package com.zmj.sy.mom.srv.aps.controller;

import com.zmj.sy.mom.srv.aps.bean.vo.base.BasePageResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.Result;
import com.zmj.sy.mom.srv.aps.service.WeldingUploadConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RequiredArgsConstructor
@Api(tags = "焊接上料配置")
@RestController
@RequestMapping("/weldingUploadConfig")
public class WeldingUploadConfigController {

    private final WeldingUploadConfigService weldingService;

    /**
     * @Description: 焊接工位手动动态分配
     *
     * @author: hejiahui
     * @since: 2024/10/6 10:51
     */
    @ApiOperation(value = "焊接工位手动动态分配", notes = "@作者  hejiahui   @操作时间  2022年10月15日15:45:07")
    @PostMapping("/dynamicDistributeStation")
    public Result dynamicDistributeStation(@ApiParam(value = "工位编号", required = true) @RequestParam(name = "stations") String stations,
                                           @ApiParam(value = "拼装阶段", required = true) @RequestParam(name = "phase") String[] phase){
        try {
            weldingService.dynamicDistributeStation(stations, phase);
            return Result.success("调用成功！");
        } catch (Exception e) {
            return Result.error("调用失败！"+e.getMessage());
        }
    }
    /**
     * @Description: 查询焊接工位手动动态分配结果
     *
     * @author: hejiahui
     * @since: 2024/10/6 10:59
     */
    @ApiOperation(value = "查询焊接工位手动动态分配结果", notes = "@作者  hejiahui   @操作时间  2022年10月15日15:45:07")
    @GetMapping("/getDistributeStationResult")
    public Result getDistributeStationResult(@ApiParam(value = "工作组") @RequestParam(name = "group",required = false)String group,
                                                    @ApiParam(value = "工位") @RequestParam(name = "station",required = false)String station,
                                                    @RequestParam(name = "pageSize",required = false)Long pageSize,
                                                    @RequestParam(name = "pageNo",required = false)Long pageNo) {
        try {
            Result result = weldingService.getDistributeStationResult(group,station,pageSize,pageNo);
            return result;
        } catch (Exception e) {
            return Result.error("调用失败！"+e.getMessage());
        }
    }
}
